@extends('layout.home')
@section('title', 'CRM方案申请登录界面')
@section('content')
    <style>
        *{padding: 0;margin: 0}
        html{width: 100%;height: 100%;}
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            background: url("http://wx.newamstar.com:8078/newstar2/public/img/cloud_banner.png") no-repeat left;
            overflow: hidden;
        }

        .container {
            width: 100%;
            max-width: 400px;
            margin: 5% auto;
            background-color: #ffffff;
            padding: 30px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            border: 1px solid black;
        }

        h2 {
            text-align: center;
            margin-bottom: 20px;
        }

        .input-group {
            margin-bottom: 15px;
        }

        label {
            display: block;
            margin-bottom: 5px;
        }

        input[type="text"],
            input[type="password"] {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 3px;
        }

        button {
            width: 100%;
            padding: 10px;
            background-color: #007bff;
            color: #ffffff;
            border: none;
            border-radius: 3px;
            cursor: pointer;
        }

        button:hover {
            background-color: #0056b3;
        }
        .tip {
           color: #6c757d;
           font-size: 12px;
           text-align: center;
          
       }
    </style>
    <div class="container">
        <h2>申请方案查询系统登录</h2>
        <form>
            <div class="input-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" required>
            </div>
            <div class="input-group">
                <label for="password">密码</label>
                <input type="password" id="password" name="password" required>
            </div>
            <button class="login">登录</button>
        </form>
    </div>
    <div class="tip">Copyright©{{ date('Y') }} 新美星数字化中心提供技术支持</div>
    <script>
       $(function(){
            $('.login').click(function(){
                var username = $('#username').val();
                var password = $('#password').val();
                $.ajax({
                    url: 'http://wx.newamstar.com:8078/newstar/public/crm_search_system_login',
                    data: {username: username,password: password},
                    success:function(data){
                        var data = JSON.parse(data);
                        if(data){
                            alemsg("登录成功");
                            localStorage.setItem("username",username);
                            location.href = data.jumpurl;
                        }else{
                            alemsg("用户名或密码错误");
                        }
                    }   
                });
               
                return false;
            })

            function alemsg(msg){
                layer.msg(msg, {
                    time: 0 //不自动关闭
                    ,btn: ['OK']
                    ,skin: 'layui-layer-molv'
                    ,yes: function(index){
                        
                        layer.close(index);
                    }
                });
            }


       })


        
    </script>
@endsection
